package cn.edu.scau.cmi.maikejian.client.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.edu.scau.cmi.maikejian.spring.domain.Student;

//本例子使用Spring，学生、教师对象都预先封装好，直接获取使用
public class SpringApplicationContextClient {

	public SpringApplicationContextClient() {
		
	}

	public static void main(String[] args) {
		ApplicationContext applicationContext = getApplicationContext1();
		Student student1 = (Student) applicationContext.getBean("zhangsan");
		System.out.println(student1.getName() + "，的毕业设计指导导师是：" + student1.getTutor().getName());

	}

	private static ApplicationContext getApplicationContext1() {
		ApplicationContext ac1 = new ClassPathXmlApplicationContext("cn/edu/scau/cmi/maikejian/spring/util/applicationContext.xml");

		return ac1;
	}

}
